{% extends 'base/header.html' %}


{% block title %}
    {% if blog %}
        编辑信息
    {% else %}
        保存信息
    {% endif %}
{% endblock %}

{% block header %}
    <script src="{% static 'bootstrap/js/tinymce.min.js' %}"></script>
{#    <script src="https://cdn.tiny.cloud/1/zc0727hwyq3sqtxe8klea5g5ob7w1wkqiiz3zzvb933hbf7s/tinymce/7/tinymce.min.js"#}
{#            referrerpolicy="origin"></script>#}
{% endblock %}


{% block body %}

    <form method="post" enctype="multipart/form-data">
        {#        {% csrf_token %}#}
        <div class="form-group">
            <label for="title">标题:</label>
            <input type="text" id="title" class="form-control" name="title" value="{{ blog.title|default_if_none:'' }}">
        </div>

        <div class="form-group">
            <label for="classify">分类:</label>
            <input type="text" id="classify" name="classify" class="form-control"
                   value="{{ blog.classify|default_if_none:'' }}">
        </div>

        <div class="form-group">
            <label for="tiny">内容:</label>
            <textarea id="tiny" class="form-control"
                      name="content">{{ blog.content|default_if_none:'' }}</textarea>

                    <div>
{#            <textarea id="tiny" name="content"></textarea>#}
        </div>
        </div>

        <div class="form-group">
            <label for="cover">封面图片</label>
            <input type="file" id="cover" class="form-control" name="cover" value="{{  blog.cover }}">
        </div>

        <button type="submit" class="btn btn-success mt-2">保存</button>
    </form>


    <script>
        window.onload = function () {
            tinymce.init({
                selector: 'textarea#tiny'
            });
        }
    </script>
{% endblock %}

